﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace SpectrumAnalyser.Shell.Converters
{
    public class InverselyProportionalConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double resultValue;
            if (double.TryParse(value.ToString(), out resultValue))
            {
                return 1/resultValue;
            }

            throw new Exception("Value of double should be submitted.");
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}